package ru.pachkun.home.block;

import org.openqa.selenium.support.FindBy;

import ru.yandex.qatools.htmlelements.element.HtmlElement;
import ru.yandex.qatools.htmlelements.element.Select;
import ru.yandex.qatools.htmlelements.element.TextInput;

public class MRPOSpecialInformationBlock extends HtmlElement {
	
	@FindBy(name = "mailTypeID")
	private Select mailTypeID;

	@FindBy(name = "transTypeID")
	private Select transTypeID;

	@FindBy(name = "aviaRate")
	private TextInput aviaRate;
	
	public MRPOSpecialInformationBlock getMailTypeID(String text) {
		if (text == null) {
			return this;
		}
		mailTypeID.selectByVisibleText(text);
		return this;
	}

	public MRPOSpecialInformationBlock setTransTypeID(String text) {
		if (text == null) {
			return this;
		}
		transTypeID.selectByVisibleText(text);
		return this;
	}

	public MRPOSpecialInformationBlock setAviaRate(String text) {
		if (text == null) {
			return this;
		}
		aviaRate.sendKeys(text);
		return this;
	}

	public String getMailTypeID() {
		return mailTypeID.getFirstSelectedOption().getText();
	}

	public String getTransTypeID() {
		return transTypeID.getFirstSelectedOption().getText();
	}

	public String getAviaRate() {
		return aviaRate.getText();
	}
	
}
